﻿using System;
using System.Collections.Generic;
using Allegro.MathInterface;

namespace Allegro.Mathlib
{
    public interface IFunctionMinimization
    {
        /// <summary>
        /// Tolerance
        /// </summary>
        double Tolerance { get; set; }

        /// <summary>
        /// Minimize function f in the interval [a,b]. The start value x must be between a and b
        /// </summary>
        /// <param name="f"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="x0">Start value. Returns the </param>
        /// <param name="xmin">Argument value of minimum</param>
        /// <returns>Minimum value of function in the interval</returns>
        double FindMinimum(Function f, double a, double b, double x0, out double xmin);
    }
    public interface IFunctionMinimizationWithDifferentiation
    {
        /// <summary>
        /// Tolerance
        /// </summary>
        double Tolerance { get; set; }

        /// <summary>
        /// Minimize function f in the interval [a,b]. The start value x must be between a and b
        /// </summary>
        /// <param name="f">Function f(x)</param>
        /// <param name="df">Differentiation function df/dx</param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="x0">Start value. Returns the </param>
        /// <param name="xmin">Argument value of minimum</param>
        /// <returns>Minimum value of function in the interval</returns>
        double FindMinimum(Function f, Function df, double a, double b, double x0, out double xmin);
    }
    public interface IVectorFunctionOptimizationWithDifferentiation
    {
        double FindMinimum(VectorFunction f, IDifferentiation diff, double[] position);
    }
}
